package com.etc.dao.impl;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
/**
 * @author Amber
 */
import com.etc.dao.SceneDao;
import com.etc.entity.Scene;
import com.etc.util.DBUtil;
/**
 * 
 * @author Amber
 *
 */
public class SceneDaoImpl implements SceneDao{

	@Override
	public List<Scene> findAll() {
		List<Scene> list = new ArrayList<Scene>();
		ResultSet rs = DBUtil.query("SELECT scene_id,scene_name FROM scene");
		try {
			while (rs.next()) {
				Integer sceneId = rs.getInt("scene_id");
				String sceneName = rs.getString("scene_name");
				
				Scene scene = new Scene();
				scene.setSceneId(sceneId);
				scene.setSceneName(sceneName);
				
				list.add(scene);
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return list;
	}

}
